<# # It is recommended to test the script on a local machine for its purpose and effects. # ManageEngine Endpoint Central will not be responsible for any # damage/loss to the data/setup based on the behavior of the script. # Description: Script is designed to fetch the size of the User profiles available under the C:\Users # Configuration Type - COMPUTER #> $users = (Get-ChildItem "C:\Users").name foreach ($user in $users) { try { $size = "{0:N2} MB" -f ((Get-ChildItem "C:\Users\$user" -Recurse -Force -ErrorAction Stop | Measure-Object -Property Length -Sum).Sum / 1Mb) Write-Host "The size of the Folder 'C:\Users\$user' is $size" } catch { Write-Host "Error occurred while accessing user folder for $user : $_" } }